import axios from 'axios'
const baseURL = 'http://www.lovegf.cn:8888/api/private/v1/'
axios.defaults.baseURL =baseURL

//拦截器
axios.interceptors.request.use(function(config){
    let token =localStorage.getItem('mytoken')
    //设置到请求头中Authorization
    config.headers['Authorization'] = token
    return config
},function(error){
    return Promise.reject(error)
})

//登陆验证
export const checkUser = params =>{
    return axios.post('login',params).then(res => res.data)
}

//获取用户列表
export const getUserList = params =>{
    return axios.get('user',params).then(res => res.data)
}
//获取左侧菜单栏权限
export  const getMenus = () =>{
    return axios.get('menus').then(res => res.data)
}